/*************************************************************************
> File Name: 005.c
> Author: icebear
> Mail: 3322366195@qq.com
> Created Time: 2023-07-24 16:34:20
> Description: 二维数组赋值 打印
************************************************************************/

#include <stdio.h>
void safeScanfInt(int *i);
int main(int argc, char const *argv[])
{
    int arr[3][3];
    int *p = &arr[0][0];
    printf("input 9 number\n");
    // 不建议使用
    for (int i = 0; i < 9; i++)
    {
        safeScanfInt(p + i);
    }
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            printf("%d ", arr[i][j]);
        }
        printf("\n");
    }

    return 0;
}

void safeScanfInt(int *i)
{
    scanf("%*[^0-9]");
    scanf("%d*[^\n]%*c", i);
}